import axios from "axios";

const service = axios.create({
  baseURL: "/api", // url = base url + request url
  timeout: 50000, // request timeout
});

/**
 * http request 拦截器
 */
service.interceptors.request.use(
  (config) => {
    // config.headers["aaaa"] = "";
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

/**
 * http response 拦截器
 */
service.interceptors.response.use(
  (response) => {
    console.log(response, "response");
    return response.data;
  },
  (error) => {
    console.log(error);
  }
);

export default service;
